package com.spzx.product.api;

import com.spzx.common.core.constant.SecurityConstants;
import com.spzx.common.core.constant.ServiceNameConstants;
import com.spzx.common.core.domain.R;
import com.spzx.product.api.domain.Product;
import com.spzx.product.api.domain.ProductSku;
import com.spzx.product.api.domain.SkuPrice;
import com.spzx.product.api.domain.vo.BrandVo;
import com.spzx.product.api.domain.vo.ProductSkuVo;
import com.spzx.product.api.domain.vo.SkuStockVo;
import com.spzx.product.api.factory.RemoteBrandFallbackFactory;
import com.spzx.product.api.factory.RemoteProductFallbackFactory;
import io.swagger.v3.oas.annotations.Parameter;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * ClassName: RemoteBrandService
 * Package: com.spzx.product.api
 * Description:
 */
@FeignClient(contextId = "remoteProductService",
        value = ServiceNameConstants.PRODUCT_SERVICE,
        fallbackFactory = RemoteProductFallbackFactory.class
)
public interface RemoteProductService {
    /**
     *
     * @param skuId skuId
     * @param source
     * @return
     */
    @GetMapping("/product/productSku/{skuId}")
    R<ProductSku> getProductSku(@PathVariable("skuId") Long skuId,
                                @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     *
     * @param id productId
     * @param source
     * @return
     */
    @GetMapping("/product/product/{id}")
    R<Product> getProduct(@PathVariable("id") Integer id,
                          @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     *
     * @param skuId skuId
     * @param source
     * @return
     */
    @GetMapping("/product/skuPrice/{skuId}")
    R<SkuPrice> getSkuPrice(@PathVariable("skuId") Long skuId,
                            @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     *
     * @param skuId skuId
     * @param source
     * @return
     */
    @GetMapping("/product/skuStock/{skuId}")
    R<SkuStockVo> getSkuStock(@PathVariable("skuId") Long skuId,
                              @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     *
     * @param id productId
     * @param source
     * @return
     */
    @GetMapping("/product/skuSpecValue/{id}")
    R<Map<String, Long>> getSkuSpecValue(@PathVariable("id") Long id,
                                         @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
    /**
     *
     * @param id productId
     * @param source
     * @return
     */
    @GetMapping(value = "/product/getProductDetails/{id}")
    R<List<String>> getProductDetails(@PathVariable("id") Long id,
                                      @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/product/skuPriceList")
    R<List<SkuPrice>> getSkuPriceList(@RequestParam("skuIdList")List<Long> skuIdList,
                                      @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

}
